Converting 3 dimension byte array to a single byte array [on hold]
Posted
by
Andrew Simpson
on Programmers
See other posts from Programmers
or by Andrew Simpson
Published on 2013-10-20T17:58:03Z
Indexed on
2013/10/21
22:03 UTC
Read the original article
Hit count: 295
c#
I have a 3 dimensional byte array.
The 3-d array represents a jpeg image. Each channel/array represents part of the RGB spectrum.
I am not interested in retaining black pixels. A black pixel is represented by this atypical arrangement:
myarray[0,0,0] =0;
myarray[0,0,1] =0;
myarray[0,0,2] =0;
So, I have flattened this 3d array out to a 1d array by doing this
byte[] AFlatArray = new byte[width x height x 3]
and then assigning values respective to the coordinate.
But like I said I do not want black pixels. So this array has to only contain color pixels with the x,y
coordinate. The result I want is to re-represent the image from the i
dimension byte array that only contains non-black pixels. How do I do that?
It looks like I have to store black pixels as well because of the xy
coordinate system. I have tried writing to a binary file but the size of that file is greater than the jpeg file as the jpeg file is compressed.
I am using c#.
© Programmers or respective owner